package com.token.sysflow.service;

import com.alibaba.fastjson.JSONArray;
import com.token.base.JsonGenerator;
import com.token.base.Pl;
import com.token.sql.IntegrateSql;
import com.token.sql.PrepareSql;

import java.sql.ResultSet;

/**
 * @author chenjianxiong 020/5/15
 */
public class MultDataItem {

    public static JSONArray readData(IntegrateSql iSql,String dataName) throws Exception{
        PrepareSql tSql = new PrepareSql(iSql);
        tSql.setPrepare("select Label as title,Value as value from v_MultDataItem where DataName=? and SysId=?");
        tSql.setPstValue(1, "MV_FlowType");
        tSql.setPstValue(2,Pl.getSysId());
        ResultSet rs = tSql.executeQuery();
        JSONArray arr = JsonGenerator.toJsonArray(rs);
        rs.close();
        tSql.close();
        return arr;
    }
}